package com.fulin.desginpatten.command;

import java.util.Map;

/**
 * @Description 下单命令
 * @Author fulin16
 * @Date 2020/12/10 16:02
 **/
public class OrderCommand implements Command {

    private SeniorChef chef;
    private Order order;
    public OrderCommand(){}

    public OrderCommand(SeniorChef chef,Order order){
        this.chef = chef;
        this.order = order;
    }

    @Override
    public void execute() throws InterruptedException {
        System.out.println(String.format("%d桌的订单：",order.getTable()));
        Map<String, Integer> foods = order.getFoods();
        for(Map.Entry<String,Integer> entry : foods.entrySet()){
            chef.makeFood(entry.getValue(),entry.getKey());
        }
        Thread.sleep(2000);
        System.out.println(String.format("%d卓的饭弄好了",order.getTable()));
    }
}
